﻿using PMS.Core.Configuration.CommonEnumConfigs;
using System;

namespace PMS.Data.Entities.ScheduleTasks
{
    /// <summary>
    /// Schedule task
    /// </summary>
    public partial class SystemScheduleTask : BaseEntity
    {
        /// <summary>
        /// Gets or sets the name in English
        /// </summary>
        public string TaskName { get; set; }
        /// <summary>
        /// 基于Quartz.NET计划任务，对计划任务进行分组
        /// </summary>
        public string GroupName { get; set; }
        /// <summary>
        /// 计划任务的描述信息
        /// </summary>
        public string Comment { get; set; }
        /// <summary>
        /// 计划任务 时间间隔(Cron) 基于Cron表达式
        /// </summary>
        public string CronExpression { get; set; }

        /// <summary>
        /// Gets or sets the type of appropriate IScheduleTask class
        /// </summary>
        public string Type { get; set; }

        /// <summary>
        /// Gets or sets the value indicating the state of the schedule task, relias on Quartz 
        /// </summary>
        public ScheduleJobActionStatus Status { get; set; }

        /// <summary>
        /// Gets or sets the datetime when it was started last time
        /// </summary>
        public DateTime? LastStartTimeUtc { get; set; }

        /// <summary>
        /// Gets or sets the datetime when it was finished last time (no matter failed is success)
        /// </summary>
        public DateTime? LastStopTimeUtc { get; set; }

        /// <summary>
        /// Gets or sets the datetime when it was successfully finished last time
        /// </summary>
        public DateTime? LastSuccessTimeUtc { get; set; }

        /// <summary>
        /// 自动任务超时时间
        /// 任务超时设定 单位：毫秒(milliseconds),请求启动计划任务超时等待时间，一般无需要等待，除非需要同步获取执行结果
        /// </summary>
        public int? RunTimeOut { get; set; }

        // Ignored
        //public bool IsActive { get; set; }
        //public DateTime CreatedOnTimeUtc { get; set; }
        //public DateTime UpdatedOnTimeUtc { get; set; }
    }
}
